package com.chw.service.impl;

import com.chw.mapp.BrandMappr;
import com.chw.model.Brand;
import com.chw.service.BrandService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class BrandServiceImpl implements BrandService {
    @Autowired
    private BrandMappr brandMappr;

    @Override
    public Object queryBrand(Brand brand) {

        return brandMappr.queryBrand(brand);
    }

    @Override
    public void updateBrand(Brand brand) {

        brandMappr.updateBrand(brand);
    }

    @Override
    public void addBrand(Brand brand) {
        brand.setIsDel(1);
        brand.setCreateDate(new Date());
        brandMappr.addBrand(brand);
    }

    @Override
    public void deleteBrand(Integer id, Integer isDel) {
        if (isDel==1){
           isDel=2;
        }else {

        }
        brandMappr.deleteBrand( id,isDel);
    }
}
